//package org.openoa.engine.conf.mvc;
//
//import com.google.common.collect.Lists;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.cors.CorsConfiguration;
//import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
//import org.springframework.web.filter.CorsFilter;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//
///**
// *@Author JimuOffice
// * @Description //TODO $
// * @Date 2022-05-07 16:47
// * @Param
// * @return
// * @Version 1.0
// */
//@Configuration
//public class CorsConfig implements WebMvcConfigurer {
////    @Override
////    public void addCorsMappings(CorsRegistry registry) {
////        registry.addMapping("/**")
////                .allowedOriginPatterns("*")
////                .allowedMethods("GET","HEAD","POST","PUT","DELETE","OPTIONS")
////                .allowCredentials(true)
////                .maxAge(3600)
////                .allowedHeaders("*");
////    }
//
//    @Bean
//    @ConditionalOnMissingBean(CorsFilter.class)
//    public CorsFilter corsFilter() {
//        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
//        CorsConfiguration corsConfiguration = new CorsConfiguration();
//        corsConfiguration.setAllowedOriginPatterns(Lists.newArrayList("*"));
//        corsConfiguration.setAllowCredentials(true);
////        corsConfiguration.addAllowedOrigin("*");
//        corsConfiguration.addAllowedHeader("*");
//        corsConfiguration.addAllowedMethod("*");
//        corsConfiguration.setMaxAge(10000L);
//        source.registerCorsConfiguration("/**", corsConfiguration);
//        org.springframework.web.filter.CorsFilter corsFilter = new org.springframework.web.filter.CorsFilter(source);
//        return corsFilter;
//    }
//}
